Skip to content

macvlan

字数
216 字
阅读时间
2 分钟

容器-gitlab设置开机启动服务

shell
# 进入容器
sudo docker exec -it gitlab-ce bash

# 创建服务目录
mkdir -p /opt/gitlab/sv/natpierce

# 创建启动脚本
cat > /opt/gitlab/sv/natpierce/run << 'EOF'
#!/bin/sh
exec 2>&1
# 替换成你的 natpierce 实际路径和启动命令
exec /path/to/natpierce [参数]
EOF

# 设置执行权限
chmod +x /opt/gitlab/sv/natpierce/run

# 启用服务(创建软链接)
ln -s /opt/gitlab/sv/natpierce /opt/gitlab/service/

# 立即启动服务
gitlab-ctl start natpierce

Docker

gitlab权限

tex
$ git clone git@192.168.3.2:tools/dlt645_power_meter_simulation_test.git
Cloning into 'dlt645_power_meter_simulation_test'...
fatal: detected dubious ownership in repository at '/var/opt/gitlab/git-data/repositories/@hashed/39/fa/39fa9ec190eee7b6f4dff1100d6343e10918d044c75eac8f9e9a2596173f80c9.git'
To add an exception for this directory, call:

        git config --global --add safe.directory /var/opt/gitlab/git-data/repositories/@hashed/39/fa/39fa9ec190eee7b6f4dff1100d6343e10918d044c75eac8f9e9a2596173f80c9.git
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

由于移动复制备份数据区域导致的权限问题,进入到docker-gitlab终端执行:

shell
# 查看所有用户
cat /etc/passwd---

# 更改权限
chown -R git:git /var/opt/gitlab/gitlab-data/

贡献者

The avatar of contributor named as Px Px

页面历史

撰写